<template>
  <div>
    <slot></slot>
    <div v-if="error">
      <span class="el-form-item__error" v-for="(item, index) in msgList" v-if="showMsg(index)" :key="index">{{item.text}}</span>
    </div>

  </div>
</template>
<script>

export default {
  props: {
    error: {
      type: Boolean,
      default: false,
    },
    msgList: {
      type: Array,
    },
  },
  data() {
    return {

    };
  },
  methods: {
    showMsg(index) {
      let flag = true;
      for (let i = 0; i < index.length; i += 1) {
        flag = !this.msgList[index].show && flag;
      }
      flag = !this.msgList[index].show && flag;
      return flag;
    },
  },
};
</script>
<style>
</style>
